home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / manageme / tcpdump-.001 / tcpdump-~ / tcpdump-3.0.2-linux / libpcap-0.0.6 / Makefile.in < prev    next >
Encoding:
Makefile  |  1995-09-30  |  6.4 KB  |  239 lines

  1. #  Copyright (c) 1993, 1994, 1995
  2. #     The Regents of the University of California.  All rights reserved.
  3. #
  4. #  Redistribution and use in source and binary forms, with or without
  5. #  modification, are permitted provided that: (1) source code distributions
  6. #  retain the above copyright notice and this paragraph in its entirety, (2)
  7. #  distributions including binary code include the above copyright notice and
  8. #  this paragraph in its entirety in the documentation or other materials
  9. #  provided with the distribution, and (3) all advertising materials mentioning
  10. #  features or use of this software display the following acknowledgement:
  11. #  ``This product includes software developed by the University of California,
  12. #  Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
  13. #  the University nor the names of its contributors may be used to endorse
  14. #  or promote products derived from this software without specific prior
  15. #  written permission.
  16. #  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  17. #  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  18. #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  19. #
  20. # @(#) $Header: Makefile.in,v 1.37+ 94/06/25 14:53:47 leres Exp $ (LBL)
  21.  
  22. #
  23. # Various configurable paths
  24. #
  25. # where the installed pcap files go
  26. INCL_DIR = /usr/local/include
  27. # where libpcap.a should go
  28. LIB_DIR = /usr/local/lib
  29. # where man page should go
  30. MAN_DIR = /usr/local/man
  31. #
  32. # Owner of installed files
  33. #
  34. BIN_GRP = bin
  35. BIN_OWN = bin
  36.  
  37. #
  38. # You shouldn't need to edit anything below.
  39. #
  40.  
  41. #have-ethers#ETHERS_DEFINES = -DETHER_SERVICE
  42.  
  43. #have-sunos5#OS_DEFINES = -DSOLARIS
  44.  
  45. DEFINE_STDC = -D__STDC__
  46. #have-gcc#DEFINE_STDC =
  47. #have-irix4#OS_DEFINES = -Dvolatile= $(DEFINE_STDC)
  48. #have-irix5#OS_DEFINES = -Dvolatile= $(DEFINE_STDC)
  49.  
  50. #have-pf#PCAP_DEFINES = -DPCAP_PF
  51.  
  52. #have-bpf#PCAP = bpf
  53. #have-dlpi#PCAP = dlpi
  54. #have-nit#PCAP = nit
  55. #have-pf#PCAP = pf
  56. #have-snit#PCAP = snit
  57. #have-snoop#PCAP = snoop
  58. #have-linux#PCAP = linux
  59.  
  60. CCOPT = -O
  61. INCLUDES = -I.
  62. #have-linux#INCLUDES = -I. -Ilinux-include
  63. DEFINES = -DFDDI $(ETHERS_DEFINES) $(PCAP_DEFINES) $(OS_DEFINES)
  64.  
  65. # Standard CFLAGS
  66. CFLAGS = $(CCOPT) $(DEFINES) $(INCLUDES)
  67.  
  68. # Standard C compiler
  69. CC = cc
  70. GCC_FLAGS = -Wmissing-prototypes -Wstrict-prototypes
  71. #have-gcc1#GCC_FLAGS =
  72. #have-gcc#CC = gcc -g -Wall $(GCC_FLAGS)
  73.  
  74. #
  75. # Flex and bison allow you to specify the prefixes of the global symbols
  76. # used by the generated parser.  This allows programs to use lex/yacc
  77. # and link against libpcap.  If you don't have flex or bison, get them.
  78. #
  79. LEX = lex
  80. YACC = yacc
  81. #have-flex#LEX = flex -Ppcap_
  82. #have-bison#YACC = bison -y -p pcap_
  83.  
  84. MAKE = make
  85. SHELL = /bin/sh
  86.  
  87. RANLIB = true
  88. #have-ranlib#RANLIB = ranlib
  89.  
  90. # Explicitly define compiliation rule since SunOS 4's make doesn't like gcc.
  91. # Also, gcc does not remove the .o before forking 'as', which can be a
  92. # problem if you don't own the file but can write to the directory.
  93. .c.o:
  94.     rm -f $@; $(CC) $(CFLAGS) -c $*.c
  95.  
  96. PCAPSRC = \
  97.     pcap-$(PCAP).c
  98. CSRC =    pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c savefile.c \
  99.     bpf_filter.c bpf_image.c
  100. LSRC =    scanner.l
  101. YSRC =    grammar.y
  102. GENSRC = \
  103.     $(LSRC:.l=.c) $(YSRC:.y=.c)
  104.  
  105. SRC =    $(PCAPSRC) $(CSRC) $(GENSRC)
  106. ALLSRC = \
  107.     pcap-bpf.c pcap-dlpi.c pcap-enet.c pcap-nit.c pcap-pf.c \
  108.     pcap-snit.c pcap-snoop.c \
  109.     $(CSRC) checkioctl.c $(LSRC) $(YSRC)
  110.  
  111. OBJ =    $(SRC:.c=.o)
  112. # Some makes can't handle the above substitution
  113. #have-broken-make#OBJ = pcap-$(PCAP).o \
  114. #have-broken-make#    pcap.o inet.o gencode.o optimize.o nametoaddr.o \
  115. #have-broken-make#    etherent.o savefile.o  bpf_filter.o bpf_image.o \
  116. #have-broken-make#    scanner.o grammar.o
  117.  
  118. HDR =    pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
  119.     ethertype.h gencode.h
  120. GENHDR = \
  121.     tokdefs.h
  122.  
  123. TAGFILES = \
  124.     $(SRC) $(HDR)
  125.  
  126. TARFILES = \
  127.     README CHANGES INSTALL VERSION Makefile.in pcap.3 mkdep \
  128.     $(ALLSRC) $(HDR) \
  129.     net bpf/net/bpf_filter.c bpf/net/bpf.h SUNOS4 configure
  130.  
  131. CLEANFILES = \
  132.     $(OBJ) libpcap.a checkioctl lex.yy.c $(GENSRC) $(GENHDR)
  133.  
  134. libpcap.a: $(OBJ)
  135.     rm -f libpcap.a
  136.     ar rc $@ $(OBJ)
  137.     $(RANLIB) $@
  138.  
  139. checkioctl: checkioctl.c
  140.     rm -f $@; $(CC) $(CFLAGS) $@.c -o $@
  141.  
  142. scanner.c: scanner.l
  143.     rm -f $@; $(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
  144.  
  145. scanner.o: scanner.c tokdefs.h
  146.     rm -f $@; $(CC) $(CFLAGS) $(LEX_DEFINES) -c $*.c
  147.  
  148. tokdefs.h: grammar.c
  149. grammar.c: grammar.y
  150.     rm -f grammar.c tokdefs.h
  151.     $(YACC) -d $<
  152.     mv y.tab.c grammar.c
  153.     mv y.tab.h tokdefs.h
  154.  
  155. grammar.o: grammar.c
  156.     $(CC) -c $(CFLAGS) -Dyylval=pcap_lval grammar.c
  157.  
  158. install: force
  159.     @for i in $(INCL_DIR) $(LIB_DIR) ; do \
  160.         if [ ! -d $$i ] ; then \
  161.             echo "mkdir $$i"; \
  162.             mkdir $$i; \
  163.             chmod 755 $$i; \
  164.             chown $(BIN_OWN) $$i; \
  165.             chgrp $(BIN_GRP) $$i; \
  166.         else \
  167.             true; \
  168.         fi; \
  169.     done
  170.     cp libpcap.a $(LIB_DIR); \
  171.         chmod 444 $(LIB_DIR)/libpcap.a; \
  172.         chown $(BIN_OWN) $(LIB_DIR)/libpcap.a; \
  173.         chgrp $(BIN_GRP) $(LIB_DIR)/libpcap.a
  174.     -$(RANLIB) $(LIB_DIR)/libpcap.a
  175.     cp pcap.h pcap-namedb.h $(INCL_DIR); \
  176.         chmod 444 $(INCL_DIR)/pcap.h $(INCL_DIR)/pcap-namedb.h; \
  177.         chown $(BIN_OWN) $(INCL_DIR)/pcap.h $(INCL_DIR)/pcap-namedb.h; \
  178.         chgrp $(BIN_GRP) $(INCL_DIR)/pcap.h $(INCL_DIR)/pcap-namedb.h
  179.     @if [ ! -f /usr/include/net/bpf.h ]; then \
  180.         i=$(INCL_DIR)/net; \
  181.         if [ ! -d $$i ] ; then \
  182.             echo "mkdir $$i"; \
  183.             mkdir $$i; \
  184.             chmod 755 $$i; \
  185.             chown $(BIN_OWN) $$i; \
  186.             chgrp $(BIN_GRP) $$i; \
  187.         else \
  188.             true; \
  189.         fi; \
  190.         set -x; \
  191.         cp net/bpf.h $(INCL_DIR)/net; \
  192.         chmod 444 $(INCL_DIR)/net/bpf.h; \
  193.         chown $(BIN_OWN) $(INCL_DIR)/net/bpf.h; \
  194.         chgrp $(BIN_GRP) $(INCL_DIR)/net/bpf.h; \
  195.     fi
  196.  
  197. install-man: force
  198.     @i=$(MAN_DIR)/man3; \
  199.     if [ ! -d $$i ] ; then \
  200.         echo "mkdir $$i"; \
  201.         mkdir $$i; \
  202.         chmod 755 $$i; \
  203.         chown $(BIN_OWN) $$i; \
  204.         chgrp $(BIN_GRP) $$i; \
  205.     else \
  206.         true; \
  207.     fi; \
  208.     cp pcap.3 $(MAN_DIR)/man3
  209.     chmod 444 $(MAN_DIR)/man3/pcap.3
  210.     chown $(BIN_OWN) $(MAN_DIR)/man3/pcap.3
  211.     chgrp $(BIN_GRP) $(MAN_DIR)/man3/pcap.3
  212.  
  213. clean:
  214.     rm -f $(CLEANFILES)
  215.  
  216. realclean:
  217.     rm -f $(CLEANFILES) Makefile tags
  218.  
  219. tags: $(TAGFILES)
  220.     ctags -wtd $(TAGFILES)
  221.  
  222. tar:    force
  223.     @cwd=`pwd` ; dir=`basename $$cwd` ; name=libpcap-`cat VERSION` ; \
  224.         list="" ; tar="tar cFFf" ; \
  225.         for i in $(TARFILES) ; do list="$$list $$name/$$i" ; done; \
  226.         echo \
  227.         "rm -f ../$$name; ln -s $$dir ../$$name" ; \
  228.          rm -f ../$$name; ln -s $$dir ../$$name ; \
  229.         echo \
  230.         "(cd .. ; $$tar - [lots of files]) | compress > /tmp/$$name.tar.Z" ; \
  231.          (cd .. ; $$tar - $$list) | compress > /tmp/$$name.tar.Z ; \
  232.         echo \
  233.         "rm -f ../$$name" ; \
  234.          rm -f ../$$name
  235.  
  236. force:    /tmp
  237. depend:    $(GENSRC) force
  238.     ./mkdep -c $(CC) $(DEFINES) $(INCLUDES) $(SRC)
  239.